<html>
<head>
	<meta charset="UTF-8">
	<meta content="IE=edge" http-equiv="X-UA-Compatible">
	<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
	<title>2921：[Poi1998]Assembler circuits</title>
	<!-- css -->
	<link href="../css/base.min.css" rel="stylesheet">
	<link href="../css/project.min.css" rel="stylesheet">
	
	<!-- favicon -->
	<!-- ... -->
</head>
<body class="page-brand">
	<header class="header header-transparent header-waterfall ui-header">
		<ul class="nav nav-list pull-left">
			<li>
				<a data-toggle="menu" href="#menu">
					<span class="icon icon-lg">menu</span>
				</a>
			</li>
		</ul>
		<a class="header-logo header-affix-hide margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">[Poi1998]Assembler circuits</a>
		<span class="header-logo header-affix margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">[Poi1998]Assembler circuits</span>
	</header>
	<nav aria-hidden="true" class="menu" id="menu" tabindex="-1">
		<div class="menu-scroll">
			<div class="menu-content">
				<a class="menu-logo" href="../index.html">BZOJ离线题库</a>
				<ul class="nav">
					<li>
						<a class="waves-attach" data-toggle="collapse" href="#problems">题目</a>
						<ul class="menu-collapse collapse in" id="problems">
							<li>
								<a class="waves-attach" href="../index.html">主页</a>
							</li>
							<li>
								<a class="waves-attach" href="../list.html">题目列表</a>
							</li>
						</ul>
					</li>
					<li>
						<a class="collapsed waves-attach" data-toggle="collapse" href="#about">关于</a>
						<ul class="menu-collapse collapse" id="about">
							<li>
								<a class="waves-attach" href="../about.html">关于此项目</a>
							</li>
						</ul>
					</li>
					
				</ul>
			</div>
		</div>
	</nav>
	<main class="content">
		<div class="content-header ui-content-header">
			<div class="container">
				<h1 class="content-heading">
                [Poi1998]Assembler circuits                </h1>
                <p>时间限制：1s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  空间限制：128MB</p>			</div>
		</div>
		<div class="container">
			<section class="content-inner margin-top-no">
				<div class="row">
					<div class="col-lg-13 col-md-13">
						<div class="card margin-bottom-no">
							<div class="card-main">
								<div class="card-inner">
									
                                <h3>题目描述</h3><p><div style="text-indent: 24pt"><span style="font-size: medium">Bytetel公司想改进它们生产的计算机，它们想用一些特殊的汇编电路门系统来替代汇编程序。汇编程序由许多单独的任务组成，每个任务有四个元素。</span></div>
<div style="margin: 0cm 0cm 0pt 45pt; text-indent: -21pt"><span style="font-size: medium">l<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>两个寄存器作为输入</span></div>
<div style="margin: 0cm 0cm 0pt 45pt; text-indent: -21pt"><span style="font-size: medium">l<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>一个运算符</span></div>
<div style="margin: 0cm 0cm 0pt 45pt; text-indent: -21pt"><span style="font-size: medium">l<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>一个寄存器作为输出</span></div>
<div style="text-indent: 24pt"><span style="font-size: medium">我们假设最多有26个寄存器，分别用小写字母a～z表示。此外有四种运算，用大写字母A，B，C，D表示。</span></div>
<div style="text-indent: 24pt"><span style="font-size: medium">一个汇编电路包括：</span></div>
<div style="margin: 0cm 0cm 0pt 45pt; text-indent: -21pt"><span style="font-size: medium">l<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>输入端映射到寄存器，该寄存器的初值作为电路的输入</span></div>
<div style="margin: 0cm 0cm 0pt 45pt; text-indent: -21pt"><span style="font-size: medium">l<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>输出端同样映射到寄存器，电路的输出作为给寄存器的值</span></div>
<div style="text-indent: 24pt"><span style="font-size: medium">一个电路由许多门组成，每个门包括两个输入和一个输出，它将输入的值进行一个基本运算，并将结果输出。门的输入和整个电路的输出要么与其它门的输出端相连，要么和整个电路的输出端相连。门的输出和整个电路的输入要么与其它门的输入端相连，要么和整个电路的输出端相连。电路门之间不会形成回路。</span></div>
<div style="text-indent: 24pt"><span style="font-size: medium">如果一个电路门系统和一个汇编程序对于任意的输入，它们的输出都相同，那么我们就称它们是等效的。</span></div>
<div><span style="font-size: medium">任务：</span></div>
<div style="margin: 0cm 0cm 0pt 42pt; text-indent: -18pt"><span style="font-size: medium">1、读入一个汇编程序的描述</span></div>
<div style="margin: 0cm 0cm 0pt 42pt; text-indent: -18pt"><span style="font-size: medium">2、计算最少要几个门可以组成与汇编程序等效的电路系统</span></div>
<div style="margin: 0cm 0cm 0pt 42pt; text-indent: -18pt"><span style="font-size: medium">3、输出</span></div></p><hr/><h3>输入格式</h3><p><div>&nbsp;</div>
<div style="text-indent: 24pt"><span style="font-size: medium">第一行包含一个整数n，(1&lt;=n&lt;1000)，表示汇编程序的指令数。以后n行每行包含4个字母表示一条指令，第一个字母为A,B,C,D中的一个，表示操作的类型，第二和第三个字母为小写字母，表示输入的寄存器，第四个字母也是小写字母，表示输出的寄存器。</span></div></p><hr/><h3>输出格式</h3><p><p>&nbsp;</p>
<div style="text-indent: 24pt"><span style="font-size: medium">包含一个整数，表示与给汇编程序等效的电路门系统中最少需要几个电路门。</span></div></p><hr/><h3>样例输入</h3><pre>8
Afbc
Bfbd
Cddd
Bcbc
Afcc
Afbf
Cfbb
Dfdb
</pre><hr/><h3>样例输出</h3><pre>
6</pre><hr/><h3>提示</h3><p>没有写明提示</p><hr/><h3>题目来源</h3><p>没有写明来源</p>
								</div>
							</div>
						</div>
					</div>
				</div>
				
				
			</section>
		</div>
	</main>

	<div class="fbtn-container">
		<div class="fbtn-inner">
			<a class="fbtn fbtn-lg fbtn-brand-accent waves-attach waves-circle waves-light waves-effect" data-toggle="dropdown" aria-expanded="true"><span class="fbtn-text fbtn-text-left">Menu</span><span class="fbtn-ori icon">apps</span><span class="fbtn-sub icon">close</span></a>
			<div class="fbtn-dropup">
				<a class="fbtn fbtn-brand waves-attach waves-circle waves-light waves-effect" href="../list.html" target="_self"><span class="fbtn-text fbtn-text-left">题目列表</span><span class="icon">menu</span></a>
				<a class="fbtn fbtn-green waves-attach waves-circle waves-effect" href="../index.html" target="_self"><span class="fbtn-text fbtn-text-left">返回主页</span><span class="icon">home</span></a>
				<a class="fbtn waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/submitpage.php?id=2921" target="_blank"><span class="fbtn-text fbtn-text-left">提交代码</span><span class="icon">send</span></a>
				<a class="fbtn fbtn-orange waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/wttl/wttl.php?pid=2921" target="_blank"><span class="fbtn-text fbtn-text-left">试题讨论</span><span class="icon">chat</span></a>
				
			</div>
		</div>
	</div>

	<!-- js -->
	<script src="../js/jquery.min.js"></script>
	<script src="../js/base.min.js"></script>
	<script src="../js/project.min.js"></script>
</body>
</html>